package _0926.inherit;

class Animal2{}
class Cat2 extends Animal2{
	public void eatFish() {}
}
class Dog2 extends Animal2{
	public void catchMouse() {}
}
class Pig extends Animal2{
	public void cute() {}
}
class AnimalTest{
	public void doSomething(Animal2 a) {
		if (a instanceof Cat2) {
			((Cat2)a).eatFish();
		}else if (a instanceof Dog2) {
			((Dog2)a).catchMouse();
		}else {
			((Pig)a).cute();
		}
	}
}

public class InstanceofDemo2 {
	public static void main(String[] args) {
		
	}
}
